home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / fiftnth.wrl < prev    next >
Text File  |  1995-06-14  |  4KB  |  112 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example fifteen -Define a camera for the world using the PerspectiveCamera node
  4.  
  5. # This camera gives you a point of view reversed from the default
  6. # You see the whole body of the Earth and Moon reflecting sunlight.
  7. DEF StartingCamera PerspectiveCamera {
  8.     position 2 10 73     # x, y, and z values of position
  9.     orientation 0.25 0 0.63 0 # We'll twist the orientation of the camera a bit
  10.     focalDistance 200    # Set it to a nice big value.
  11. }
  12.  
  13. # Here comes the Sun
  14. # The Separator node groups everything within it together
  15. DEF SOLAR_SYSTEM Separator {
  16.  
  17.     # The material will effect all subsequent nodes
  18.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  19.     # We're switching to emissive color because the Sun gives off light.
  20.     Material {
  21.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  22.     }
  23.  
  24.     # We'll make the Sun shine here
  25.     # A PointLight shines equally in all directions, like the Sun does.
  26.     DEF SUNLIGHT PointLight {
  27.         intensity 1        # The Sun is way bright
  28.         color 1 1 0.9   # Sunlight is basically white, even though the Sun is yellow.
  29.     }
  30.  
  31.     # The WWWAnchor node is a group node
  32.     # This means that all objects within it are linked with the anchor's URL
  33.     # We want to link the Sun, so the Sun's Sphere node goes inside of it.
  34.     # Using the description field, we provide context for the user
  35.     # The DEF node attaches the name "SUN" to the WWWAnchor group
  36.     DEF SUN WWWAnchor {
  37.         name "http://www.w3.org/" # The root URL of the World Wide Web
  38.         description "A link from the Sun to W3.ORG" # Decriptive text
  39.  
  40.         # Inside the anchor, because WWWAnchor is a group node
  41.         Sphere {
  42.             radius 10        # Big Sun
  43.         }
  44.     }
  45.  
  46.     # We place the Earth within it's own Separator
  47.     # To keep everything good and isolated
  48.     Separator {
  49.  
  50.         # Let's move things out of the way here
  51.         Transform {
  52.             translation 0 20 20
  53.         }
  54.  
  55.         # Color the Earth blue, and make it absorb light
  56.         # But also make it a reflective, like water
  57.         DEF EARTH_MATERIAL Material {
  58.             diffuseColor 0 0 1 # Big blue marble
  59.             specularColor 0.9 0.9 0.9 # And a little more shiny
  60.             shininess 0.9 # Water is rather shiny
  61.         }
  62.  
  63.         # The WWWAnchor node is a group node
  64.         # This means that all objects within it are linked with the anchor's URL
  65.         # We want to link the Earth, so the Earth's Sphere node goes inside of it.
  66.         # Using the description field, we provide context for the user
  67.         # The DEF node attaches the name "Earth" to the WWWAnchor node
  68.         DEF EARTH WWWAnchor {
  69.             name "http://hyperreal.com/~mpesce/book/examples/second.wrl" # Another world
  70.             description "A link to another world" # Decriptive text
  71.  
  72.             # Finally, create the earth
  73.             Sphere {
  74.                 radius 2    # Little Earth
  75.             }
  76.         }
  77.  
  78.         # The Moon gets its own Separator
  79.         # Because we really do keep everything separate
  80.         Separator {
  81.  
  82.             # The Moon is just outside the Earth
  83.             Transform {
  84.                 translation 4 4 0
  85.             }
  86.  
  87.             # Color the Moon grey, make it absorb light
  88.             # It's a little shiny, but not much
  89.             Material {
  90.                 diffuseColor 0.7 0.7 0.7
  91.                 shininess 0.3
  92.             }
  93.  
  94.             # The WWWAnchor node is a group node
  95.             # This means that all objects within it are linked with the anchor's URL
  96.             # We want to link the Moon, so the Moon's Sphere node goes inside of it.
  97.             # Using the description field, we provide context for the user
  98.             # The DEF node attaches the name "Moon" to the WWWAnchor node
  99.             DEF Moon WWWAnchor {
  100.                 name "http://www.cyborganic.com:80/People/paul/The_new_dogs/pescewrd.au"
  101.                 description "Sounds from a talk about VRML"
  102.  
  103.                 # And now, create the Moon
  104.                 Sphere {
  105.                     radius 1    # Tiny Moon
  106.                 }
  107.             }
  108.         }
  109.     }
  110. }
  111.  
  112.